<template>
  <div>
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了">
      <my-cell
        v-for="item in list"
        :key="item.id"
        :item="item"
        :label="item.LabelName ? item.LabelName[0] : { name: '测试' }"
        @goArticleContent="goArticlePage"
      ></my-cell>
    </van-list>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import MyCell from '../../components/Cell.vue'
export default {
  components: {
    MyCell
  },
  async mounted() {
    this.list = this.searchMomentList
    console.log(this.searchMomentList)
  },
  data() {
    return {
      list: [],
      loading: false,
      finished: true
    }
  },
  watch: {
    searchMomentList: 'listChange'
  },
  methods: {
    goArticlePage(item) {
      if (item) {
        this.$router.push(`/artcontent/${item.id}`)
      }
    },
    listChange() {
      console.log('变了')
      this.list = this.searchMomentList
    }
  },
  computed: {
    ...mapState(['searchMomentList'])
  }
}
</script>

<style scoped lang="less">
.van-list {
  margin-top: 100px;
}
</style>
